import * as THREE from 'three';
export const addCamera = (scene: THREE.Scene, SCREEN_WIDTH: number, SCREEN_HEIGHT: number) => {
  // CAMERA
  const VIEW_ANGLE = 45,
    ASPECT = SCREEN_WIDTH / SCREEN_HEIGHT,
    NEAR = 0.1,
    FAR = 20000;
  const camera = new THREE.PerspectiveCamera(VIEW_ANGLE, ASPECT, NEAR, FAR);

  camera.position.set(0, 150, 400);
  camera.lookAt(scene.position);
  scene.add(camera);
  return camera;
};
export const addFloor = (scene: THREE.Scene) => {
  const floorTexture = new THREE.TextureLoader().load('images/checkerboard.jpg');
  floorTexture.wrapS = floorTexture.wrapT = THREE.RepeatWrapping;
  floorTexture.repeat.set(10, 10);
  const floorMaterial = new THREE.MeshBasicMaterial({ map: floorTexture, side: THREE.DoubleSide });
  const floorGeometry = new THREE.PlaneGeometry(1000, 1000, 10, 10);
  const floor = new THREE.Mesh(floorGeometry, floorMaterial);
  floor.position.y = -100;
  floor.rotation.x = Math.PI / 2;
  scene.add(floor);
};
export const addSKYBox = (scene: THREE.Scene) => {
  const skyBoxGeometry = new THREE.BoxGeometry(10000, 10000, 10000);
  const skyBoxMaterial = new THREE.MeshBasicMaterial({ color: 0x9999ff, side: THREE.BackSide });
  const skyBox = new THREE.Mesh(skyBoxGeometry, skyBoxMaterial);
  scene.fog = new THREE.FogExp2(0x9999ff, 0.00025);
  scene.add(skyBox);
};
